﻿//
//  HFHttpAbstractFactory.h
//  ChinaNationalSports
//
//  Created by Points on 2020/3/31.
//  Copyright © 2020 hfqf123@126.com. All rights reserved.
// http请求

#import <coobjc/coobjc.h>

#ifndef HFHttpAbstractFactory_h
#define HFHttpAbstractFactory_h

// RSA加密公钥 生产
#define RSA_PUBLICKEY_DIS @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDG99hKW8Oqo1sDyzBpBxQM6lG1BvBNCAIsJstcdl3wSCPsFZ8JarKAeqZ++w7U3Hed5BEabASSIDz3yEhh7ojxzV5152sGYF9uIgtqBU0DWe7CvbW85Q1WUivJuuBjmVFaQ8hdLdcTTsBveL6QyAV29PAAe7i/+m9VgUOWzQO94QIDAQAB"

//RSA版本号
#define RSA_VERSION  @"01"

// RSA加密公钥 测试
#define RSA_PUBLICKEY_CS @"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKMyUELKmYvRyCLkDYyuWC/d05mEqIGdJfjLQKe6Xe44kQdnwSRlqZf71MqLgDtIFWwG38Ef572cLTLbZpro2Xyssr+J6+Kl0Qv/AmgJUH+zvS/P+95WjplvMy21K5UIVawX54pFjukPKFJ15jyXBGQ2etXeYG6XT/bORufi9lowIDAQAB"


#define kRSAEncryptFailTip @"太火爆啦，请稍后重试"

#define kAESLocalSaveKey @"kAESLocalSaveKey"


//typedef enum : NSUInteger {
//    DOMAIN_BASE,
//    DOMAIN_USER,
//    DOMAIN_FILE,
//    DOMAIN_FINANCE,
//    DOMAIN_QR,
//    DOMAIN_RECORD,
//    DOMAIN_POS,
//    DOMAIN_BANK,
//    DOMAIN_RIGHT,
//    DOMAIN_HTBASE,
//    DOMAIN_VIEW,
//    DOMAIN_SEE,
//    DOMAIN_PHOTO,
//    DOMAIN_NONE, //单纯填充
//} HTTP_DOMAIN;

@protocol HFHttpResponseModel <NSObject>

@end

@protocol HFHttpFailModel <NSObject>

@end

@protocol HFHttpAbstractFactory <NSObject>


typedef void(^HFHttpSucceedBlock)(id<HFHttpResponseModel> resp);

typedef void(^HFHttpFailedBlock) (id<HFHttpFailModel> error);

typedef void(^HFHttpDelayBlock) (void);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setDomain)(NSString *domain);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setPath)(NSString *path);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setRequest)(NSDictionary *para);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setImageName)(NSString *imageName);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setFileName)(NSString *fileName);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setImage)(NSData *image);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setImageArray)(NSArray *imageArray);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setMimeType)(NSString *mimetype);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setResponseBlock)(HFHttpSucceedBlock resp);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setErrorBock)(HFHttpFailedBlock error);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^post)(void);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^get)(void);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^singleUpload)(void);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^multiUpload)(void);

@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setRsaSwitch)(BOOL);

@property (nonatomic, copy) id<HFHttpAbstractFactory>(^setDelayOperationBlock)(HFHttpDelayBlock delayBlock);


/// 使用coobjc的异步处理，
@property(nonatomic,copy) COPromise<COTuple *>* (^coPost)(void);


/// 是否需要toast弹窗,默认是需要的
@property(nonatomic,copy) id<HFHttpAbstractFactory> (^setNeedToast)(BOOL needToast);
+ (instancetype)factory;

@end

#endif /* HFHttpAbstractFactory_h */

